import 'package:flutter/material.dart';

class MyApp5 extends StatelessWidget {
  const MyApp5({super.key});

  @override
  Widget build(BuildContext context) {
    final scrren = MediaQuery.of(context).size;
    return Scaffold(
      //导航条
      appBar: AppBar(
        title: const Text('Container组件的使用',
            style: TextStyle(
                fontSize: 20.0,
                fontWeight: FontWeight.bold,
                color: Colors.white)),
        backgroundColor: Colors.pink,
        centerTitle: true,
      ),
      //主体区域
      body: Center(
        child: Container(
          width: scrren.width / 2,
          height: scrren.height / 3,
          //padding: const EdgeInsets.all(10.0),
          //color: Colors.green,
          decoration: BoxDecoration(
              color: Colors.green,
              //圆角
              // borderRadius: BorderRadius.circular(10.0)
              borderRadius: BorderRadius.only(topLeft: Radius.circular(20.0)),
              //边框
              //border: Border(top: BorderSide(color: Colors.red, width: 5.0))
              border: Border.all(color: Colors.red, width: 5.0)),

          child: Container(
            //设置内容对齐方式
            alignment: Alignment.centerRight,
            color: Colors.blue,
            margin: const EdgeInsets.all(20),
            padding: const EdgeInsets.all(10.0),
            child: const Text('子组件'),
          ),
        ),
      ),
    );
  }
}
